n students divide k apples equally. The
remainder, if any, stays in the basket. Determine how many apples each student
will receive.
Input. Two positive integers n and k, each not exceeding
1500. It’s rare to have more students in a school, and eating too many apples
isn't healthy either.
Output. Print the number of apples each student will
receive.
Sample
input |
Sample
output |
3 14 |
4 |
mathematics – formula
To solve the problem, it is sufficient to compute
the quotient of k divided by n.
Read the input data.
scanf("%d
%d",&n,&k);
Compute and print the answer.
printf("%d\n",k/n);
Java
implementation
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner con = new
Scanner(System.in);
int n = con.nextInt();
int k = con.nextInt();
System.out.println(k/n);
con.close();
}
}
Python
implementation
Read the input data.
n = int(input())
k = int(input())
Compute and print the answer.
res = k // n
print(res)